<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
    <script>
        class MyButton extends HTMLButtonElement{
            constructor() {
                super()
                this.addEventListener('click', e => alert('hell0 my-btton'))
            }
        }

        customElements.define('my-button', MyButton, {extends: 'button'})
    </script>
    <button is="my-button">测试btn</button>
</body>
</html>